package com.killers.cold.util;


import cn.hutool.core.bean.BeanUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class BeanHelper {
    private static final Logger logger = LoggerFactory.getLogger(BeanHelper.class);

    public static <T> T convertTo(Object oriObj, Class<T> targetClazz) {
        try {
            T targetObj = targetClazz.newInstance();
            BeanUtil.copyProperties(oriObj,targetObj);
            return targetObj;
        } catch (InstantiationException | IllegalAccessException e) {
            logger.error("bean类型转换失败");
        }
        return null;
    }

}
